<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>尚品汇，欢迎登录</title>
	<link rel="icon" href="./img/favicon.ico">

	<link rel="stylesheet" type="text/css" href="/css/all.css" />
	<link rel="stylesheet" type="text/css" href="/css/pages-login.css" />
	<div th:include="common/head :: head"></div>
</head>

<body>
<!-- 头部栏位 -->
<!--页面顶部-->
<div th:include="common/header :: header"></div>

<div class="login-box">

	<!--loginArea-->
	<div class="loginArea">
		<div class="py-container login">
			<div class="loginform">
				<ul class="sui-nav nav-tabs tab-wraped">
					<li id="tabOtherLogin" onclick="switchOtherLogin()">
						<a href="javascript:void(0)" data-toggle="tab" >
							<h3>扫描登录</h3>
						</a>
					</li>
					<li id="tabSuiForm" class="active" onclick="switchSuiForm()">
						<a href="javascript:void(0)" data-toggle="tab" >
							<h3>账户登录</h3>
						</a>
					</li>
				</ul>
				<div class="tab-content tab-wraped">
					<div id="index" class="tab-pane ">
						<p>二维码登录，暂为官网二维码</p>
						<img src="./img/wx_cz.jpg" />
					</div>
					<div id="profile" class="tab-pane active">
						<form class="sui-form">
							<div class="input-prepend"><span class="add-on loginname"></span>
								<input id="inputName" type="text" v-model="user.loginName" placeholder="邮箱/用户名/手机号" class="span2 input-xfat">
							</div>
							<div class="input-prepend"><span class="add-on loginpwd"></span>
								<input id="inputPassword" type="password" v-model="user.passwd" placeholder="请输入密码" class="span2 input-xfat">
							</div>
							<div class="setting">
								<label class="checkbox inline">
									<input name="m1" type="checkbox" value="2" checked="">
									自动登录
								</label>
								<span class="forget">忘记密码？</span>
							</div>
							<div class="logined">
								<a class="sui-btn btn-block btn-xlarge btn-danger" href="javascript:" @click="submitLogin()">登&nbsp;&nbsp;录</a>
							</div>
						</form>
						<div class="otherlogin">
							<div class="types">
								<ul>
									<li><img src="./img/qq.png" width="35px" height="35px" /></li>
									<li><img src="./img/sina.png" /></li>
									<li><img src="./img/ali.png" /></li>
									<li><img src="./img/weixin.png" /></li>
								</ul>
							</div>
							<span class="register"><a href="register.html" target="_blank">立即注册</a></span>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--foot-->
	<div class="py-container copyright">
		<ul>
			<li>关于我们</li>
			<li>联系我们</li>
			<li>联系客服</li>
			<li>商家入驻</li>
			<li>营销中心</li>
			<li>手机尚品汇</li>
			<li>销售联盟</li>
			<li>尚品汇社区</li>
		</ul>
		<div class="address">地址：北京市昌平区宏福科技园综合楼6层</div>
		<div class="beian">京ICP备19006430号
		</div>
	</div>
</div>

<!--页面底部END-->
<script src="/js/api/login.js"></script>
<script th:inline="javascript">
	var item = new Vue({
		el: '#profile',

		data: {
			originUrl: [[${originUrl}]],
			user: {
				loginName: '',
				passwd: ''
			}
		},

		created() {
		},

		methods: {
			submitLogin() {
				login.login(this.user).then(response => {//response.data.data==Result.data
					if (response.data.code == 200) {
					//把token存在cookie中、也可以放在localStorage中   //SessionStorage
					auth.setToken(response.data.data.token)
					auth.setUserInfo(JSON.stringify(response.data.data))
					if(this.originUrl == ''){
						window.location.href="http://www.gmall.com"
						return ;
					} else {
						window.location.href = decodeURIComponent(this.originUrl)
					}
				} else {
					alert(response.data.data.message)
				}

			})
			}
		}
	})
</script>
</body>
</html>
